package cn.qyl.joha.service.Impl;

import java.util.List;

import cn.qyl.joha.dao.UserDao;
import cn.qyl.joha.dao.Impl.UserDaoImpl;
import cn.qyl.joha.dto.User;
import cn.qyl.joha.service.UserService;

/**
 * 用户业务层实现类
 * @author Administrator
 *
 */
public class UserServiceImpl implements UserService {
	
	UserDao userDao = new UserDaoImpl();

	@Override
	public User getUserLogin(String username, String password) {
		User user = userDao.getUserLogin(username,password);
		return user;
	}
	
	
	@Override
	public List<User> getUser(User user) {
		List<User> users = userDao.getUsers(user);
		return users;
	}

	//新增用户功能实现
	@Override
	public void addUser(User user) {
		userDao.addUser(user);
	}

	//修改功能获取User对象
	@Override
	public User getUserById(int id) {
		
		return userDao.getUserById(id);
	}

	//更新用户
	@Override
	public int updateUser(User user) {
		
		return userDao.updateUser(user);
	}

	//根据id删除单个用户
	@Override
	public int delUserById(int id) {
		
		return userDao.delUserById(id);
	}

	//批量删除
	@Override
	public int delUserByIds(int[] ids) {
		
		return userDao.delUserByIds(ids);
	}

	//注册用户
	@Override
	public void register(User user) {
	
		userDao.register(user);
		
	}

}	


